You can connect api authentication with OAuth2 Provider. This module enables OAuth2 authentication within Odoo, providing secure API access with the authorization-code-grant flow.
OAuth2 Authentication
Odoo API Authentication
API Security
Authentication for APIs
OAuth2 Token Management
OAuth2 Authorization
Authorization Code Grant
API OAuth2 Authentication
57